<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>广告倒计时<span>10</span>秒</div>
    <script>
        console.log("start")
        let firstAlarm = setTimeout(function(){
            console.log("我将会在5秒后出现");
        },5000);
        console.log("end")

        //倒计时
        let num = Number.parseInt(document.querySelector("span").innerHTML);
        let broadAlarm = 0;
        function doWrok(){
            document.querySelector("span").innerHTML = "welcome";
            clearTimeout(broadAlarm);
        }
         setTimeout(doWrok,1000*num);
            broadAlarm = setInterval(function(){
            document.querySelector("span").innerHTML = --num;
        },5000)
</script>
</body>
</html>